package week6;

public class PC {
    private CPU cpu;
    private HardDisk hardDisk;
    public void setCpu(CPU cpu){
        this.cpu = cpu;
    }
    public void setHardDisk(HardDisk hardDisk){
        this.hardDisk = hardDisk;
    }
    public void show(){
        System.out.println("CPU速度: " + cpu.getSpeed());
        System.out.println("硬盘容量: " + hardDisk.getAmount());
    }

    public static void main(String[] args) {
        CPU cpu = new CPU();
        cpu.setSpeed(2200);
        HardDisk disk = new HardDisk();
        disk.setAmount(200);
        PC pc = new PC();
        pc.setCpu(cpu);
        pc.setHardDisk(disk);
        pc.show();
    }
}
